package com.xyzwps.gpars

import static groovyx.gpars.actor.Actors.actor

class Ex02MoreGroovyHelloWorld {
    static void main(String[] args) {
        def decryptor = actor {
            loop {
                react { message ->
                    if (message instanceof String) reply message.reverse()
                    else stop()
                }
            }
        }

        def console = actor {
            decryptor << 'lellarap si yvoorG'
            react {
                println 'Decrypted message: ' + it
                decryptor << false
            }
        }

        [decryptor, console]*.join()
    }
}
